﻿using System;
using System.Windows.Forms;

namespace LightLibrary {
	public interface IFormAssetEdit {
		bool ResultOk { get; }
		DialogResult ShowDialog();
	}

	public partial class FormAssetBookEdit : Form, IFormAssetEdit {
		public bool ResultOk { get; private set; }

		public FormAssetBookEdit(Asset asset) {
			InitializeComponent();
			_asset = (AssetBooks)asset;
		}

		private readonly AssetBooks _asset;

		private void btnDone_Click(object sender, System.EventArgs e) {
			_asset.Authors = authorsTextBox.Text;
			_asset.Edition = editionTextBox.Text;
			_asset.Title = titleTextBox.Text;
			_asset.Year = Convert.ToInt32(yearNumeric.Value);

			ResultOk = true;
			Close();
		}

		private void btnCancel_Click(object sender, EventArgs e) {
			ResultOk = false;
			Close();
		}
	}
}
